function formatterIsValid(val) {
    if(val==0){
        return "失效";
    }
    if(val==1){
        return "正常";
    }
}
function formatterDate(val) {
      return  formatDate(val);
}
function formatterDrugType(val) {
    if(val){
        return "西药";
    }else {
        return "中药";
    }
}

function openAddDrugDialog() {
    openDlg("dlg","添加药品");
}
function openModifyDrugDialog() {
    openModifyDlg("dg","fm","dlg","修改药品");
}
function closeDlg() {
    initFormData("fm");
    closeDlgData("dlg");

}
function saveOrUpdateAccount() {
    var id=$("#id").val();
    var submitUrl = ctx + "savedrug";
    if(!isEmpty(id)){
        submitUrl="updatedrug"
    }
    saveOrUpdate("fm",submitUrl,"dlg",searchDrugByParams);
}
function searchDrugByParams() {
    $("#dg").datagrid("load",{
        drugName:$("#drugName").val(),
        drugType:$("#drugType").combobox("getValue"),
        isValid:$("#isValid").combobox("getValue")
    })
}
function deleteDrug() {
    deleteData("dg","deletedrugs",searchDrugByParams);
}

